package com.cosmoplat.xikai.business.domain.vo;

import com.cosmoplat.xikai.business.enums.MaterialEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @ClassName MaterialRequirementVo
 * @Description 物料需求管理
 * @Author wdf
 * @Date 2025/1/7
 */
@Data
@ApiModel(value = "物料需求管理", description = "用于表示系统中的物料需求信息")
public class MaterialRequirementVo {


    @ApiModelProperty(value = "配送物料id",  example = "1")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 订单号
     */
    @ApiModelProperty(value = "订单号",  example = "WORKORDER001")
    private String workOrderNo;


    /**
     * 任务号
     */
    @ApiModelProperty(value = "任务号",  example = "TASKNO001")
    private String taskNo;


    /**
     * 物料编号
     */
    @ApiModelProperty(value = "物料编号",  example = "CODE001")
    private String materialCode;

    /**
     * 物料名称
     */
    @ApiModelProperty(value = "物料名称",  example = "示例物料")
    private String materialName;

    /**
     * 所需数量
     */
    @ApiModelProperty(value = "所需数量", required = true, example = "100.00")
    private BigDecimal requiredQty;


    /**
     * 配送位置编号
     */
    @ApiModelProperty(value = "配送位置编号", required = true, example = "DP001")
    private String deliveryPosCode;

    /**
     * 配送位置名称
     */
    @ApiModelProperty(value = "配送位置名称", required = true, example = "仓库A")
    private String deliveryPosName;

    /**
     * 是否缺料告警
     */
    @ApiModelProperty(value = "是否缺料告警，1：是,0：否",  example = "0")
    private Integer shortage;

    /**
     * 产线库存数
     **/
    @ApiModelProperty(value = "产线库存数", example = "100.00")
    private BigDecimal stockQty;

    /**
     * 安全库存数
     **/
    @ApiModelProperty(value = "安全库存数", example = "100.00")
    private BigDecimal safeStockQty;



    @ApiModelProperty(value = "是否库存修改标识，1：是,0：否",  example = "0")
    private Integer stockModifyFlag;

    /**
     * 是否库存修改标识，1：是,0：否
     **/
    public Integer getStockModifyFlag() {
        if(MaterialEnum.inStockMaterial(this.materialCode)) {
            return 1;
        }
        return 0;
    }
}
